package com.itheima.myreflect2.Student;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @program: Myset
 * @description:字符缓冲输出流 BufferedWriter
 * @author: xuejingjing
 * @create: 2021-06-15 22:00
 **/
public class CharStreamDemo10 {
    public static void main(String[] args) throws IOException {

        //字符缓冲输出流
        BufferedWriter bw = new BufferedWriter( new FileWriter("a.txt"));

        //写出数据
        bw.write(97);
        bw.write("\r\n");
        //实际写出的是97---101 对应的字符abcde
        char [] chars ={97,98,99,100,101};
        bw.write(chars);
        bw.write("\r\n");
        bw.write(chars,0,3);//写入这个数组中的0-3 索引
        bw.write("\r\n");
        bw.write("黑马程序员");
        bw.write("\r\n");
        String line = "abcjjjd";
        bw.write(line,0,5);
        bw.flush();
        bw.close();
    }
}
